<?php $this->load->view('partials/breadcrumb.tpl', Array('_BTN_GROUP' => array('url' => site_url($thisModule . $thisController), 'class' => 'btn default', 'name' => '返回列表', 'i' => '<i class="m-icon-swapleft"></i>'))) ?>
<div class="row">
    <div class="col-md-12">
        <div class="portlet box yellow">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-coffee"></i>物流信息
                </div>
            </div>
            <div class="portlet-body">
                <div class="table-scrollable">
                    <table class="table table-bordered table-hover">
                        <tbody>
                        <tr>
                            <th>物流ID：</th>
                            <th><?= $obj->id ?></th>

                            <th>物流单号：</th>
                            <th colspan="2"><?= $obj->shipping_number ?></th>

                            <th>所属账户：</th>
                            <th><?= $allShops[$obj->shop_id] ?></th>

                            <th>发货人：</th>
                            <th><?= $allPurchaser[$obj->operator_id] ?></th>
                            <th>发货城市：</th>
                            <th><?= IOSS_StaticConfig::getShippingWarehouse($obj->location) ?></th>

                            <th>发货时间：</th>
                            <th><?= date('Y-m-d',$obj->shipping_time) ?></th>
                            <th>成本：</th>
                            <th colspan="3"><?= $obj->cost ?></th>
                        </tr>
                        <tr>
                            <th>物流方式：</th>
                            <th><?= $obj->shipping_desc ?></th>
                            <th>打包箱数：</th>
                            <th colspan="2"><?= $obj->boxs ?></th>
                            <th>运费：</th>
                            <th><?= $obj->freight ?></th>
                            <th>备注：</th>
                            <th><?= $obj->remark ?></th>
                            <th>状态：</th>
                            <th>
                                <label class="label <?= $obj->status?'label-success':'label-danger' ?>"><?= MStorageShipping::getState($obj->status) ?></label>
                            </th>
                            <th>创建时间：</th>
                            <th colspan="3"><?= date('Y-m-d H:i',$obj->create_time) ?></th>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-12">
        <!-- BEGIN BORDERED TABLE PORTLET-->
        <div class="portlet box blue">
            <div class="portlet-title">
                <div class="caption" style="display: flex;justify-content: space-between;width: 100%;align-items: center;">
                    <div>
                         打包信息
                    </div>
                </div>
            </div>
            <div class="portlet-body">
                <div class="table-scrollable">
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>商品名称</th>
                            <th>商品单价</th>
                            <th>商品数量</th>
                            <th>商品总计</th>
                            <th>采购人</th>
                            <th>责任人</th>
                            <th>出入库方式</th>
                            <th>商品批次</th>
                            <th>所属仓库</th>
                            <th>所在仓库区</th>
                            <th>所属账户</th>
                            <th>采购时间</th>
                            <th>状态</th>
                            <th>备注</th>
                            <th>创建时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach ($allRecords as $v) { ?>
                            <tr>
                                <td><?= $v->id ?></td>
                                <td style="position: relative">
                                    <?= htmlspecialchars($v->product_name) . '(id:' . $v->product_id . ')' ?>
                                    <?= $v->type == 0 && $v->status == 1 ? ($v->has_deliver ? '<span style="position: absolute;top: -8px;right: 0;" class="label label-success"> 已发货 </span>' : '<span style="position: absolute;top: -8px;right: 0;" class="label label-warning"> 待发货 </span>') : '' ?>
                                </td>
                                <td><?= htmlspecialchars($v->price) ?></td>
                                <td><?= htmlspecialchars($v->quantity) ?></td>
                                <td><?= htmlspecialchars($v->amount) ?></td>
                                <td><?= htmlspecialchars($allPurchaser[$v->purchaser_id]) ?></td>
                                <td><?= htmlspecialchars($v->related_person) ?></td>
                                <td <?php if ($v->type_mark == 7): ?>class="popovers" data-container="body"
                                    data-trigger="hover" data-placement="top"
                                    data-content="<?= $v->order_no ?>"<?php endif; ?>><?= IOSS_StaticConfig::getShippingType($v->type_mark) ?></td>
                                <td>
                                    <label class="label label-info"><?= htmlspecialchars($v->warehousing) ?></label>
                                </td>
                                <td><?= $v->location ? IOSS_StaticConfig::getShippingWarehouse($v->location) : '未入库' ?></td>
                                <td><?= $v->area ? IOSS_StaticConfig::getShippingBlock($v->area) : '未入库' ?></td>
                                <td><?= htmlspecialchars($allShops[$v->shop_id]) ?></td>
                                <td><?= date('Y-m-d', $v->purchase_time) ?></td>

                                <td><?= MStorageRecord::getState($v->status) ?></td>
                                <td><?= htmlspecialchars($v->remark) ?></td>
                                <td><?= date('Y-m-d H:i', $v->create_time) ?></td>
                            </tr>
                        <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- END BORDERED TABLE PORTLET-->
    </div>

</div>

<script>
    $(document).ready(function () {
        var list = $(".left-item");
        var total = 0;
        for (var i = 0;i < list.length; i++){
            total += parseFloat(list.eq(i).text());
        }
       $("#total").html(total);
    })

</script>